<script>
    window.addEventListener('pageshow', function (event) {
        if (!(event.persisted || window.performance && window.performance.navigation.type == 2)) {
            <% if flash[:notice] %>
            UIkit.notify("<%= flash.discard[:notice] %>", {status:'success'})
            <% end %>
            <% if flash[:alert] %>
            UIkit.notify("<%= flash.discard[:alert] %>", {status:'danger'})
            <% end %>
        }
    },false);
</script>